
@echo off
cd /d %~dp0..
set TheMaterRoot=%cd%

premake5 vs2022



Title Build %~dp0

echo BuildSln
cd /d %TheMaterRoot%\MaterialTest
call version.bat

if exist %TheMaterRoot%\MaterialTest-Mini-Frame\MaterialTest ( call %TheMaterRoot%\MaterialTest-Mini-Frame\MaterialTest\version.bat )
if exist %TheMaterRoot%\MaterialTestGND ( call %TheMaterRoot%\MaterialTestGND\version.bat )


cd /d %TheMaterRoot%
set buildtype=Release

Title Build %TheMaterRoot% %buildtype%



::if not "%VS140COMNTOOLS%"=="" (call "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat" x86)
set thetoolset=msvc-14.3
set VSWHERE=C:\PROGRA~2\"Microsoft Visual Studio"\Installer\vswhere.exe
for /f "usebackq tokens=*" %%i in (`%VSWHERE% -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do (
  set InstallDir=%%i
)
echo %InstallDir%
set VS_VARSALL=%InstallDir%\VC\Auxiliary\Build\vcvarsall.bat
call "%VS_VARSALL%" x64_x86


echo build 
@ping 127.0.0.1 -n 2 >nul

cd /d %TheMaterRoot%
set TheBuildSlnName=MaterialTest2Z(All).sln

msbuild "%TheBuildSlnName%" /p:Configuration=%buildtype%;Platform=Win32
set num=10
for /l %%i in (1,1,%num%) do (
IF %ERRORLEVEL% NEQ 0 (msbuild "%TheBuildSlnName%" /p:Configuration=%buildtype%;Platform=Win32)
)
IF %ERRORLEVEL% NEQ 0 (echo build error & pause)

@ping 127.0.0.1 -n 5 >nul
:_BuildSlnEND

cd /d %~dp0
call TBuildPdb.bat


cd /d %~dp0
call TGenPkg.bat

cd /d %~dp0
call TGenSTD.bat


cd /d %~dp0
call TGenUdd.bat


cd /d %~dp0
::call TGenUdd-Mini.bat

@ping 127.0.0.1 -n 3 >nul
